/**
 * 
 */
package com.lanswon.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lanswon.dao.ArticleMapper;
import com.lanswon.dao.CommonProblemMapper;
import com.lanswon.entity.ArticleVO;
import com.lanswon.entity.CommonProblem;

/**
 * @author lanswon
 *
 */
@Service
public class CommonProblemService {
	@Autowired
	private CommonProblemMapper commonProblemMapper;

	public int addCommonProblem(CommonProblem commonProblem) {
		Date time = new Date();
		commonProblem.setCreateTime(time);
		commonProblem.setUpdateTime(time);
		return commonProblemMapper.insert(commonProblem);
	}
	
	public int updateCommonProblem(CommonProblem commonProblem) {
		commonProblem.setUpdateTime(new Date());
		return commonProblemMapper.updateByPrimaryKeySelective(commonProblem);
	}

	public void deleteCommonProblem(Long articleId) {
		commonProblemMapper.deleteByPrimaryKey(articleId);
	}

	public Integer pageListCount(Map<String, Object> map){
		return commonProblemMapper.selectProblemPageListCount(map);
	}
	
	public List<CommonProblem> pageList(Map<String, Object> map){
		return commonProblemMapper.selectCommonProblemPageList(map);
	}

	public CommonProblem findCommonProblemById(Long articleId) {
		return commonProblemMapper.selectByPrimaryKey(articleId);
	}
	
	public Integer findCommonProblemCountByCondition(Map<String, Object> map) {
		return commonProblemMapper.selectCommonProblemCountByCondition(map);
	}

	public List<CommonProblem> findCommonProblemByCondition(Map<String, Object> map) {
		return commonProblemMapper.selectCommonProblemByCondition(map);
	}

	
}
